<#include "includemenu.html"/>
<script type="text/javascript">

//提交表移动表单
function submitMoveForm(){

	$("#tableform").attr("action","/${orgi}/dm/database/${dbid}/${tabledirid}/tablemoveList.html");
	$("#tableform").submit();
}


//批量删除表的form
function delTablesForm(){
	 if($("input[name='tableids']:checked").length>0){
	 	art.confirm('您确定删除选中的这些表？',
	 	function(){
	 		$("#tableform").attr("action","/${orgi}/dm/database/${dbid}/${tabledirid}/tabledellist.html");
	 		$("#tableform").submit();
	 	},
	 	function(){})
	 }else{
		 alertMsg("请先选择要删除的表");
	 }
	}
function tableMovePannel(){
 	if($("input[name='tableids']:checked").length>0){
		$("#tablesmove").click();
	 }else{
		 alertMsg("请先选择要移动的表");
	 }
	 
}
<#if param?? && table??>
$(document).ready(function(){
	$("#id_${table.id!''}").click();	
});
</#if>
</script>
<!--<div class="rs_layout_right" style="width:300px;"></div>-->
<div class="rs_layout_center">
	<div class="rs_layout">
		<div class="rs_layout_center"> 	
			<div class="tableScrollWrap">
			<form id="tableform" method="post" action="">
			<input id="tabledirid" name="tabledirid" type="hidden" value=""/>
			<input id= "dbid" name="dbid"  type="hidden"value=""/> 
			
			<input id= "dirid" name="dirid"  type="hidden" value=""/>
				<table class="table_style_1">
					<thead>
						<tr>
							<th style="width:30px;"></th>
							<th><i class="verMidWrap">名称</i><i class="tbArrow"></i></th>
							<#if parentid=='1'>
							<th><i class="verMidWrap">模型名称</i><i class="tbArrow"></i></th>
							</#if>
							<th class="minSize"><i class="verMidWrap">创建时间</i><i class="tbArrow"></i></th>
							<th class="minSize minIsHide"><i class="verMidWrap">修改时间</i><i class="tbArrow"></i></th>
							<th class="minSize"><i class="verMidWrap">类型</i><i class="tbArrow"></i></th>
							<th class="minSize">操作</th>
						</tr>
					</thead>
					<tbody>
						<#if tableList??>
						<#list tableList as table>
						
						<tr>
							<td class="tdIcons"><input name ="tableids" id="tableids" value="${table.id!''}" type="checkbox"></td>
							<td><a href="/${orgi}/dm/database/${dbid!''}/${parentid!'0'}/table/${table.id!''}.html"><i class="icons_tablelist_1"></i>${table.name!''}</a></td>
							<#if parentid=='1'>
							<td><a href="/${orgi}/dm/database/${dbid!''}/${parentid!'0'}/table/${table.id!''}.html">${table.groupid!''}</a></td>
							</#if>
							<td class="minSize"><#if table.createtime??>${table.createtime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
							<td class="minSize"><#if table.updatetime??>${table.updatetime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
							<td class="minSize"><#if table.tabletype == "1">数据表<#else>SQL</#if></td>
							<td class="minSize">
							 <#if table.tabletype ?? && table.tabletype=='2'>
								 <a href="/${orgi}/dm/database/${dbid!''}/sqledit/${tabledirid!''}/${table.id!''}.html" data-toggle="ajax" title='修改SQL查询'>
								 	<i class = "tbControlIcon tci-103"></i>
								 </a>
								 <#if table.previewtemplet ?? && table.previewtemplet?length gt 0>
								 <a href="/${orgi}/dm/database/${dbid!''}/sqlparam/${tabledirid!''}/${table.id!''}.html" id="id_${table.id!''}" data-width="450" data-toggle="ajax" title='设置默认参数'>
								 	<i class = "tbControlIcon tci-406"></i>
								 </a>
								 </#if>
						     </#if>
								<#if database??&&database.name??&&database.name=='R3_SYSTEM'>
								<a href="/${orgi}/dm/database/${dbid!''}/sqlexcute/${tabledirid!''}/${table.id!''}.html" id="id_${table.id!''}" data-width="450" data-toggle="ajax" title='SQL执行'>
								 	<i class = "tbControlIcon tci-1006"></i>
								 </a>
								 </#if>
								<a href="/${orgi}/dm/database/${dbid!''}/tabledel/${tabledirid!''}/${table.id}.html" data-toggle="delete" data-title="请确认是否删除表？" title="删除${table.name!''}">
								<i class="tbControlIcon tci-106"></i></a>
							</td>
						</tr>
						</#list>
						</#if>
					</tbody>
				</table>
				</form>
			</div>
		</div>
		<div class="rs_layout_bottom toolBar_bottom">
			<ul class="toolbarBottom_IconWrap">
					<li title="移动表" onclick="tableMovePannel()" class="tb-icons-2" ></li>
					<li style="display: none;" title="移动表" href="/${orgi}/dm/database/${dbid!''}/${tabledirid!''}/tablesmove.html"  id="tablesmove"  data-toggle="ajax" data-width="480" class="tb-icons-2" >
					</li>
				<li onclick="delTablesForm();" title="批量删除表" data-width="480"class="tb-icons-4"></li>
			</ul>
		   
		</div>
	</div>
</div>